package a_doubleWrite;

/**
 * 309. 最佳买卖股票时机含冷冻期
 *
 * @author luolidong
 * @version 1.0
 * @create 2021-07-25 20:36
 */
public class L309 {
    public int maxProfit(int[] prices) {
        int ans = 0;

        for (int j = 0; j < prices.length; j++) {
            for (int i = j; i < prices.length; i++) {
                if (prices[i] < prices[i + 1]) {
                    ans += (prices[i + 1] - prices[i]);
                    i++;
                }
            }
        }
        return ans;
    }
}
